package com.woniuxy.stage3demo.service.lyl.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.woniuxy.stage3demo.bean.chenyuxuanBean.StaffBean;
import com.woniuxy.stage3demo.bean.lyl.StationMessageBean;
import com.woniuxy.stage3demo.bean.lyl.SysMessageBean;

import com.woniuxy.stage3demo.mapper.lyl.SysMessageMapper;
import com.woniuxy.stage3demo.pageHelper.PageRequest;
import com.woniuxy.stage3demo.service.lyl.ISysMsgService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Transactional(readOnly = false)
@Service
public class SysMsgServiceImpl implements ISysMsgService {
    @Resource
    private SysMessageMapper sysMessageMapper;


    @Override
    public PageInfo<SysMessageBean> findAllByParams(PageRequest request, SysMessageBean sysMessageBean) {
        return PageHelper.startPage(request.getPageNum(),request.getLimit()).
                doSelectPageInfo(()->sysMessageMapper.findAllByParams(request,sysMessageBean));

    }
    //存储新系统消息
    @Override
    public void saveSysMessageBean(SysMessageBean sysMessageBean) {
        sysMessageMapper.saveSysMessageBean(sysMessageBean);
    }
    //删除一条系统消息
    @Override
    public void deleteOneSysMessageBean(Long id) {
        sysMessageMapper.deleteOneSysMessageBean(id);
    }
    //查询系统消息
   /* @Override
    public List<SysMessageBean> selectSysMessageBeanByTitleAndName(PageRequest request, String sysMsgTitle, String name) {
        return sysMessageMapper.selectSysMessageBeanByTitleAndName(request,sysMsgTitle,name);
    }*/

}
